// import * as React from 'react';
// import classNames from 'classnames';
// import omit from 'omit.js';
//
// export interface IconProps {
//   type: string;
//   className?: string;
//   title?: string;
//   onClick?: React.MouseEventHandler<any>;
//   spin?: boolean;
//   style?: React.CSSProperties;
// }
//
// const Index = (props: IconProps) => {
//   const { type, className = '', spin } = props;
//   const classString = classNames({
//     anticon: true,
//     'anticon-spin': !!spin || type === 'loading',
//     [`anticon-${type}`]: true,
//   }, className);
//   return <i {...omit(props, ['type', 'spin'])} className={classString} />;
// };
//
// export default Index;

import React from 'react';
import Icon from '@ant-design/icons';
import { PandaIcon, HeartIcon } from './component'

export interface IconProps {
  type?: string;
  className?: string;
  title?: string;
  onClick?: React.MouseEventHandler<any>;
  spin?: boolean;
  style?: React.CSSProperties;
}

const Index = (props: IconProps) => {
  const { type } = props;

  const iconSvg = () => {
    switch (type) {
        case 'panda':
        return PandaIcon;
        case 'heart':
        return HeartIcon;
      default:
        return PandaIcon;
    }
  }

  return <Icon
    component={iconSvg}
    {...props}
  />;
};

export default Index;
